package com.qk.management.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qk.common.PageResult;
import com.qk.domain.customer.CustomerDO;
import com.qk.dto.customer.CustomerPageDTO;
import com.qk.entity.Customer;
import com.qk.management.mapper.CustomerMapper;
import com.qk.management.service.CustomerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Just、倾城
 * @created 2025-10-17
 * @description
 *
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    @Override
    public PageResult<CustomerDO> getList(CustomerPageDTO dto) {
        PageHelper.startPage(dto.getPage(),dto.getPagesize());
        List<CustomerDO> list = this.baseMapper.selectByConditon(dto);
        Page<CustomerDO> pageInfo = (Page<CustomerDO>) list;
        return PageResult.<CustomerDO>builder().total(Long.valueOf(pageInfo.getTotal()).intValue()).rows(pageInfo.getResult()).build();
    }
}
